﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;

namespace com.woodsoft.core.Files {
	public class UIDocument : XmlDocument {
		#region Constructors
		public UIDocument ()
			: base() {
			this.AppendChild( this.CreateXmlDeclaration( "1.0" , null , null ) );
		}
		public UIDocument ( string path )
			: this() {
			FilePath = path;
		}
		#endregion

		#region Variables
		private string _filepath;
		#endregion

		#region Properties
		public string FilePath {
			get {
				return this._filepath;
			}
			set {
				this._filepath = value;
			}
		}
		#endregion

		#region Methods
		public void Save () {
			base.Save( FilePath );
		}
		/// <summary>
		/// Saves the UIDocument object to the local filesystem
		/// </summary>
		/// <param name="filename"></param>
		public override void Save ( string filename ) {
			this.FilePath = filename;
			this.Save();
		}
		/// <summary>
		/// DO NOT USE.  Stream saving is not implemented
		/// </summary>
		/// <param name="outStream"></param>
		public override void Save ( Stream outStream ) {
			//TODO: Develop Stream saving
      throw new InvalidOperationException( "UIDocument.Save(Stream) method is not implemented.  Use UIDocument.Save() or UIDocument(string) instead!" );
		}
		/// <summary>
		/// DO NOT USE. TextWriter saving not implemented
		/// </summary>
		/// <param name="writer"></param>
		public override void Save ( TextWriter writer ) {
			//TODO: Develop TextWriter saving
      throw new InvalidOperationException( "UIDocument.Save(TextWriter) method is not implemented.  Use UIDocument.Save() or UIDocument(string) instead!" );
		}
		/// <summary>
		/// DO NOT USE.  XmlWriter Saving not implemented.
		/// </summary>
		/// <param name="w"></param>
		public override void Save ( XmlWriter w ) {
			//TODO: Develop XmlWriter saving
      throw new InvalidOperationException( "UIDocument.Save(XmlWriter) method is not implemented.  Use UIDocument.Save() or UIDocument(string) instead!" );
		}
		#endregion

		#region Functions

		#endregion
	}
}
